//dup
package com.god.analyser;

import java.lang.reflect.Field;
import java.util.HashMap;
import java.util.Map;

public class FieldCollector {

	private static Map<String,Object> fieldMap;
	
	public static Map<String, Object> getFieldsMap(Object o){
		fieldMap = new HashMap<String, Object>();
		
		Field [] fields = o.getClass().getDeclaredFields();
		try{
			for(int i = 0 ; i < fields.length ; i++) {
				fields[i].setAccessible(true);
				String fieldName = fields[i].getName();
				Object fieldValue = fields[i].get(o);
				fieldMap.put(fieldName,fieldValue);
			}
			
		}catch (Exception e) {
		      System.out.println(e);
	    }
		System.out.println(fieldMap);

		return fieldMap;
	}
}
